<?php

/*
 * This class is used for as Model for Product table 
 */

class Model_Markasdata extends Model_Base {

    protected $_name = 'prp_markas_data';
    protected $_primaryKey = 'prpmark_id';

    
    public function fetchAllMarkasdata($where = "", $limit = "", $offset = "0", $order = 'prpmark_id', $sort = 'ASC') {
        $select = $this->select()
                ->from(array('markas' => 'prp_markas_data'));
        if ($where != '') {
            $select->where($where);
        }
        if ($limit != "") {
            $select->limit($limit, $offset);
        }
        $select->order($order . " " . $sort);

        $data = parent::fetchAll($select);
        if (!empty($data)) {
            return $data->toArray();
        } else {
            return array();
        }
    }
    public function fetchMarkasByPropertyId($where = '') {

        $finalArray = Array();
        $select = $this->select()
                ->from(array('que' => 'prp_markas_data'));
        // see reasoning in fetchEntries() as to why we return only an array
         if ($where != '') {
            $select->where($where);
        }
        $data = parent::fetchAll($select);
        if (!empty($data)) {
            foreach ($data as $_value) {
                    $finalArray[] = $_value['prpmark_markas_id'];
            }
            return $finalArray;
        } else {
            return $finalArray;
        }
    }
}
